package com.p7.notepad.network;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.HeaderMap;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.QueryMap;
import retrofit2.http.Url;


/**
 * Created by Administrator on 2017\11\3 0003.
 */
public interface APIServer {

    @POST
    Observable<ResponseBody> Post(@Url String url,
                                  @HeaderMap Map<String, String> headers);

    @Headers({"Content-type:application/json;charset=UTF-8"})
    @POST
    Observable<ResponseBody> Post(@Url String url,
                                  @Body RequestBody parameters);

    @Headers({"Content-type:application/json;charset=UTF-8"})
    @POST
    Observable<ResponseBody> Post(@Url String url,
                                  @HeaderMap Map<String, String> headers,
                                  @Body RequestBody parameters);

    @Multipart
    @POST
    Observable<ResponseBody> uploadFile(@Url String url,
                                        @HeaderMap Map<String, String> headers,
                                        @QueryMap Map<String, String> parameters,
                                        @Part MultipartBody.Part file);

    /*上传文件*/
    @Multipart
    @POST
    Observable<ResponseBody> uploadFile(@Url String url,
                                        @Part MultipartBody.Part file);
}
